<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Module      :  System.Console.GetOpt</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Copyright   :  (c) Sven Panne 2002-2005</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- </span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-12"></span><span class="hs-comment">--</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- This library provides facilities for parsing the command-line options</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- in a standalone program.  It is essentially a Haskell port of the GNU </span><span>
</span><span id="line-15"></span><span class="hs-comment">-- @getopt@ library.</span><span>
</span><span id="line-16"></span><span class="hs-comment">--</span><span>
</span><span id="line-17"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span class="hs-comment">{-
Sven Panne &lt;Sven.Panne@informatik.uni-muenchen.de&gt; Oct. 1996 (small
changes Dec. 1997)

Two rather obscure features are missing: The Bash 2.0 non-option hack
(if you don't already know it, you probably don't want to hear about
it...) and the recognition of long options with a single dash
(e.g. '-help' is recognised as '--help', as long as there is no short
option 'h').

Other differences between GNU's getopt and this implementation:

* To enforce a coherent description of options and arguments, there
  are explanation fields in the option/argument descriptor.

* Error messages are now more informative, but no longer POSIX
  compliant... :-(

And a final Haskell advertisement: The GNU C implementation uses well
over 1100 lines, we need only 195 here, including a 46 line example! 
:-)
-}</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Console.GetOpt</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-43"></span><span>   </span><span class="annot"><span class="hs-comment">-- * GetOpt</span></span><span>
</span><span id="line-44"></span><span>   </span><span class="annot"><a href="System.Console.GetOpt.html#getOpt"><span class="hs-identifier">getOpt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#getOpt%27"><span class="hs-identifier">getOpt'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>   </span><span class="annot"><a href="System.Console.GetOpt.html#usageInfo"><span class="hs-identifier">usageInfo</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>   </span><span class="annot"><a href="System.Console.GetOpt.html#ArgOrder"><span class="hs-identifier">ArgOrder</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>   </span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier">OptDescr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-48"></span><span>   </span><span class="annot"><a href="System.Console.GetOpt.html#ArgDescr"><span class="hs-identifier">ArgDescr</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span>   </span><span class="annot"><span class="hs-comment">-- * Examples</span></span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span>   </span><span class="hs-comment">-- |To hopefully illuminate the role of the different data structures,</span><span>
</span><span id="line-53"></span><span>   </span><span class="hs-comment">-- here are the command-line options for a (very simple) compiler,</span><span>
</span><span id="line-54"></span><span>   </span><span class="hs-comment">-- done in two different ways.</span><span>
</span><span id="line-55"></span><span>   </span><span class="hs-comment">-- The difference arises because the type of 'getOpt' is</span><span>
</span><span id="line-56"></span><span>   </span><span class="hs-comment">-- parameterized by the type of values derived from flags.</span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span>   </span><span class="annot"><span class="hs-comment">-- ** Interpreting flags as concrete values</span></span><span>
</span><span id="line-59"></span><span>   </span><span class="annot"><span class="hs-comment">-- $example1</span></span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span>   </span><span class="annot"><span class="hs-comment">-- ** Interpreting flags as transformations of an options record</span></span><span>
</span><span id="line-62"></span><span>   </span><span class="annot"><span class="hs-comment">-- $example2</span></span><span>
</span><span id="line-63"></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.List.html"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Data.OldList.html#isPrefixOf"><span class="hs-identifier">isPrefixOf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Foldable.html#find"><span class="hs-identifier">find</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span class="hs-comment">-- |What to do with options following non-options</span><span>
</span><span id="line-68"></span><span class="hs-keyword">data</span><span> </span><span id="ArgOrder"><span class="annot"><a href="System.Console.GetOpt.html#ArgOrder"><span class="hs-identifier hs-var">ArgOrder</span></a></span></span><span> </span><span id="local-6989586621679564819"><span class="annot"><a href="#local-6989586621679564819"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-69"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="RequireOrder"><span class="annot"><a href="System.Console.GetOpt.html#RequireOrder"><span class="hs-identifier hs-var">RequireOrder</span></a></span></span><span>                </span><span class="hs-comment">-- ^ no option processing after first non-option</span><span>
</span><span id="line-70"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Permute"><span class="annot"><a href="System.Console.GetOpt.html#Permute"><span class="hs-identifier hs-var">Permute</span></a></span></span><span>                     </span><span class="hs-comment">-- ^ freely intersperse options and non-options</span><span>
</span><span id="line-71"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ReturnInOrder"><span class="annot"><a href="System.Console.GetOpt.html#ReturnInOrder"><span class="hs-identifier hs-var">ReturnInOrder</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679564819"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ wrap non-options into options</span><span>
</span><span id="line-72"></span><span>
</span><span id="line-73"></span><span class="hs-comment">{-|
Each 'OptDescr' describes a single option.

The arguments to 'Option' are:

* list of short option characters

* list of long option strings (without \&quot;--\&quot;)

* argument descriptor

* explanation of option for user
-}</span><span>
</span><span id="line-86"></span><span class="hs-keyword">data</span><span> </span><span id="OptDescr"><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-var">OptDescr</span></a></span></span><span> </span><span id="local-6989586621679564813"><span class="annot"><a href="#local-6989586621679564813"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>              </span><span class="hs-comment">-- description of a single options:</span><span>
</span><span id="line-87"></span><span>   </span><span id="Option"><span class="annot"><a href="System.Console.GetOpt.html#Option"><span class="hs-identifier hs-var">Option</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span>                </span><span class="hs-comment">--    list of short option characters</span><span>
</span><span id="line-88"></span><span>          </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>              </span><span class="hs-comment">--    list of long option strings (without &quot;--&quot;)</span><span>
</span><span id="line-89"></span><span>          </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ArgDescr"><span class="hs-identifier hs-type">ArgDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564813"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>          </span><span class="hs-comment">--    argument descriptor</span><span>
</span><span id="line-90"></span><span>          </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>                </span><span class="hs-comment">--    explanation of option for user</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-comment">-- |Describes whether an option takes an argument or not, and if so</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- how the argument is injected into a value of type @a@.</span><span>
</span><span id="line-94"></span><span class="hs-keyword">data</span><span> </span><span id="ArgDescr"><span class="annot"><a href="System.Console.GetOpt.html#ArgDescr"><span class="hs-identifier hs-var">ArgDescr</span></a></span></span><span> </span><span id="local-6989586621679564810"><span class="annot"><a href="#local-6989586621679564810"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-95"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="NoArg"><span class="annot"><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-var">NoArg</span></a></span></span><span>                   </span><span class="annot"><a href="#local-6989586621679564810"><span class="hs-identifier hs-type">a</span></a></span><span>         </span><span class="hs-comment">-- ^   no argument expected</span><span>
</span><span id="line-96"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="ReqArg"><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-var">ReqArg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679564810"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-comment">-- ^   option requires argument</span><span>
</span><span id="line-97"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="OptArg"><span class="annot"><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-var">OptArg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679564810"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-comment">-- ^   optional argument</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-comment">-- | @since 4.6.0.0</span><span>
</span><span id="line-100"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679564739"><span class="annot"><a href="GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#ArgOrder"><span class="hs-identifier hs-type">ArgOrder</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-101"></span><span>    </span><span id="local-6989586621679564737"><span class="annot"><span class="annottext">fmap :: forall a b. (a -&gt; b) -&gt; ArgOrder a -&gt; ArgOrder b
</span><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var hs-var hs-var hs-var">fmap</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="System.Console.GetOpt.html#RequireOrder"><span class="hs-identifier hs-var">RequireOrder</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgOrder b
forall a. ArgOrder a
</span><a href="System.Console.GetOpt.html#RequireOrder"><span class="hs-identifier hs-var">RequireOrder</span></a></span><span>
</span><span id="line-102"></span><span>    </span><span class="annot"><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="System.Console.GetOpt.html#Permute"><span class="hs-identifier hs-var">Permute</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgOrder b
forall a. ArgOrder a
</span><a href="System.Console.GetOpt.html#Permute"><span class="hs-identifier hs-var">Permute</span></a></span><span>
</span><span id="line-103"></span><span>    </span><span class="annot"><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span id="local-6989586621679564736"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564736"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReturnInOrder"><span class="hs-identifier hs-type">ReturnInOrder</span></a></span><span> </span><span id="local-6989586621679564735"><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564735"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; b) -&gt; ArgOrder b
forall a. (String -&gt; a) -&gt; ArgOrder a
</span><a href="System.Console.GetOpt.html#ReturnInOrder"><span class="hs-identifier hs-var">ReturnInOrder</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564736"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; (String -&gt; a) -&gt; String -&gt; b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564735"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="hs-comment">-- | @since 4.6.0.0</span><span>
</span><span id="line-106"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679564731"><span class="annot"><a href="GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-107"></span><span>    </span><span id="local-6989586621679564729"><span class="annot"><span class="annottext">fmap :: forall a b. (a -&gt; b) -&gt; OptDescr a -&gt; OptDescr b
</span><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var hs-var hs-var hs-var">fmap</span></a></span></span><span> </span><span id="local-6989586621679564728"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564728"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span id="local-6989586621679564727"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564727"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679564726"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564726"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679564725"><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564725"><span class="hs-identifier hs-var">argDescr</span></a></span></span><span> </span><span id="local-6989586621679564724"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564724"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; ArgDescr b -&gt; String -&gt; OptDescr b
forall a. String -&gt; [String] -&gt; ArgDescr a -&gt; String -&gt; OptDescr a
</span><a href="System.Console.GetOpt.html#Option"><span class="hs-identifier hs-var">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564727"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564726"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; ArgDescr a -&gt; ArgDescr b
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564728"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564725"><span class="hs-identifier hs-var">argDescr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564724"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span class="hs-comment">-- | @since 4.6.0.0</span><span>
</span><span id="line-110"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679564721"><span class="annot"><a href="GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#ArgDescr"><span class="hs-identifier hs-type">ArgDescr</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-111"></span><span>    </span><span id="local-6989586621679564720"><span class="annot"><span class="annottext">fmap :: forall a b. (a -&gt; b) -&gt; ArgDescr a -&gt; ArgDescr b
</span><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var hs-var hs-var hs-var">fmap</span></a></span></span><span> </span><span id="local-6989586621679564719"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564719"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-type">NoArg</span></a></span><span> </span><span id="local-6989586621679564718"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564718"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; ArgDescr b
forall a. a -&gt; ArgDescr a
</span><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-var">NoArg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564719"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564718"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span>    </span><span class="annot"><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span id="local-6989586621679564717"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564717"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span id="local-6989586621679564716"><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564716"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679564715"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564715"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; b) -&gt; String -&gt; ArgDescr b
forall a. (String -&gt; a) -&gt; String -&gt; ArgDescr a
</span><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-var">ReqArg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564717"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; (String -&gt; a) -&gt; String -&gt; b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564716"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564715"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="annot"><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span id="local-6989586621679564714"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564714"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-type">OptArg</span></a></span><span> </span><span id="local-6989586621679564713"><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564713"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679564712"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564712"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; b) -&gt; String -&gt; ArgDescr b
forall a. (Maybe String -&gt; a) -&gt; String -&gt; ArgDescr a
</span><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-var">OptArg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679564714"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; (Maybe String -&gt; a) -&gt; Maybe String -&gt; b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564713"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564712"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="hs-keyword">data</span><span> </span><span id="OptKind"><span class="annot"><a href="System.Console.GetOpt.html#OptKind"><span class="hs-identifier hs-var">OptKind</span></a></span></span><span> </span><span id="local-6989586621679564775"><span class="annot"><a href="#local-6989586621679564775"><span class="hs-identifier hs-type">a</span></a></span></span><span>                </span><span class="hs-comment">-- kind of cmd line arg (internal use only):</span><span>
</span><span id="line-116"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="Opt"><span class="annot"><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span></span><span>       </span><span class="annot"><a href="#local-6989586621679564775"><span class="hs-identifier hs-type">a</span></a></span><span>                </span><span class="hs-comment">--    an option</span><span>
</span><span id="line-117"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="UnreqOpt"><span class="annot"><a href="System.Console.GetOpt.html#UnreqOpt"><span class="hs-identifier hs-var">UnreqOpt</span></a></span></span><span>  </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>           </span><span class="hs-comment">--    an un-recognized option</span><span>
</span><span id="line-118"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="NonOpt"><span class="annot"><a href="System.Console.GetOpt.html#NonOpt"><span class="hs-identifier hs-var">NonOpt</span></a></span></span><span>    </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>           </span><span class="hs-comment">--    a non-option</span><span>
</span><span id="line-119"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="EndOfOpts"><span class="annot"><a href="System.Console.GetOpt.html#EndOfOpts"><span class="hs-identifier hs-var">EndOfOpts</span></a></span></span><span>                  </span><span class="hs-comment">--    end-of-options marker (i.e. &quot;--&quot;)</span><span>
</span><span id="line-120"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span id="OptErr"><span class="annot"><a href="System.Console.GetOpt.html#OptErr"><span class="hs-identifier hs-var">OptErr</span></a></span></span><span>    </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>           </span><span class="hs-comment">--    something went wrong...</span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span class="hs-comment">-- | Return a string describing the usage of a command, derived from</span><span>
</span><span id="line-123"></span><span class="hs-comment">-- the header (first argument) and the options described by the </span><span>
</span><span id="line-124"></span><span class="hs-comment">-- second argument.</span><span>
</span><span id="line-125"></span><span id="local-6989586621679564809"><span class="annot"><a href="System.Console.GetOpt.html#usageInfo"><span class="hs-identifier hs-type">usageInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>                    </span><span class="hs-comment">-- header</span><span>
</span><span id="line-126"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564809"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>              </span><span class="hs-comment">-- option descriptors</span><span>
</span><span id="line-127"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span></span><span>                    </span><span class="hs-comment">-- nicely formatted description of options</span><span>
</span><span id="line-128"></span><span id="usageInfo"><span class="annot"><span class="annottext">usageInfo :: forall a. String -&gt; [OptDescr a] -&gt; String
</span><a href="System.Console.GetOpt.html#usageInfo"><span class="hs-identifier hs-var hs-var">usageInfo</span></a></span></span><span> </span><span id="local-6989586621679564706"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564706"><span class="hs-identifier hs-var">header</span></a></span></span><span> </span><span id="local-6989586621679564705"><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564705"><span class="hs-identifier hs-var">optDescr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
</span><a href="Data.OldList.html#unlines"><span class="hs-identifier hs-var">unlines</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564706"><span class="hs-identifier hs-var">header</span></a></span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564703"><span class="hs-identifier hs-var">table</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679564700"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564700"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564699"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564699"><span class="hs-identifier hs-var">ls</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564698"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564698"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(String, String, String)] -&gt; ([String], [String], [String])
forall a b c. [(a, b, c)] -&gt; ([a], [b], [c])
</span><a href="GHC.List.html#unzip3"><span class="hs-identifier hs-var">unzip3</span></a></span><span> </span><span class="annot"><span class="annottext">([(String, String, String)] -&gt; ([String], [String], [String]))
-&gt; ([OptDescr a] -&gt; [(String, String, String)])
-&gt; [OptDescr a]
-&gt; ([String], [String], [String])
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(OptDescr a -&gt; [(String, String, String)])
-&gt; [OptDescr a] -&gt; [(String, String, String)]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">OptDescr a -&gt; [(String, String, String)]
forall a. OptDescr a -&gt; [(String, String, String)]
</span><a href="System.Console.GetOpt.html#fmtOpt"><span class="hs-identifier hs-var">fmtOpt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564705"><span class="hs-identifier hs-var">optDescr</span></a></span><span>
</span><span id="line-130"></span><span>         </span><span id="local-6989586621679564703"><span class="annot"><span class="annottext">table :: [String]
</span><a href="#local-6989586621679564703"><span class="hs-identifier hs-var hs-var">table</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; String -&gt; String -&gt; String)
-&gt; [String] -&gt; [String] -&gt; [String] -&gt; [String]
forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="GHC.List.html#zipWith3"><span class="hs-identifier hs-var">zipWith3</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String -&gt; String
</span><a href="#local-6989586621679564693"><span class="hs-identifier hs-var">paste</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; [String]
</span><a href="#local-6989586621679564692"><span class="hs-identifier hs-var">sameLen</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564700"><span class="hs-identifier hs-var">ss</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; [String]
</span><a href="#local-6989586621679564692"><span class="hs-identifier hs-var">sameLen</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564699"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564698"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-131"></span><span>         </span><span id="local-6989586621679564693"><span class="annot"><span class="annottext">paste :: String -&gt; String -&gt; String -&gt; String
</span><a href="#local-6989586621679564693"><span class="hs-identifier hs-var hs-var">paste</span></a></span></span><span> </span><span id="local-6989586621679564691"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564691"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679564690"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564690"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679564689"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564689"><span class="hs-identifier hs-var">z</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564691"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564690"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564689"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-132"></span><span>         </span><span id="local-6989586621679564692"><span class="annot"><span class="annottext">sameLen :: [String] -&gt; [String]
</span><a href="#local-6989586621679564692"><span class="hs-identifier hs-var hs-var">sameLen</span></a></span></span><span> </span><span id="local-6989586621679564684"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564684"><span class="hs-identifier hs-var">xs</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [String] -&gt; [String]
</span><a href="#local-6989586621679564683"><span class="hs-identifier hs-var">flushLeft</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int] -&gt; Int
forall (t :: * -&gt; *) a. (Foldable t, Ord a) =&gt; t a -&gt; a
</span><a href="Data.Foldable.html#maximum"><span class="hs-identifier hs-var">maximum</span></a></span><span> </span><span class="annot"><span class="annottext">([Int] -&gt; Int) -&gt; ([String] -&gt; [Int]) -&gt; [String] -&gt; Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Int) -&gt; [String] -&gt; [Int]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564684"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564684"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-133"></span><span>         </span><span id="local-6989586621679564683"><span class="annot"><span class="annottext">flushLeft :: Int -&gt; [String] -&gt; [String]
</span><a href="#local-6989586621679564683"><span class="hs-identifier hs-var hs-var">flushLeft</span></a></span></span><span> </span><span id="local-6989586621679564680"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679564680"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679564679"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564679"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Int -&gt; String -&gt; String
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679564680"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564677"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; String
forall a. a -&gt; [a]
</span><a href="GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679564677"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564677"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564679"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span id="local-6989586621679564800"><span class="annot"><a href="System.Console.GetOpt.html#fmtOpt"><span class="hs-identifier hs-type">fmtOpt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564800"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span></span><span>
</span><span id="line-136"></span><span id="fmtOpt"><span class="annot"><span class="annottext">fmtOpt :: forall a. OptDescr a -&gt; [(String, String, String)]
</span><a href="System.Console.GetOpt.html#fmtOpt"><span class="hs-identifier hs-var hs-var">fmtOpt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span id="local-6989586621679564675"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564675"><span class="hs-identifier hs-var">sos</span></a></span></span><span> </span><span id="local-6989586621679564674"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564674"><span class="hs-identifier hs-var">los</span></a></span></span><span> </span><span id="local-6989586621679564673"><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564673"><span class="hs-identifier hs-var">ad</span></a></span></span><span> </span><span id="local-6989586621679564672"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564672"><span class="hs-identifier hs-var">descr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-137"></span><span>   </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String]
</span><a href="Data.OldList.html#lines"><span class="hs-identifier hs-var">lines</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564672"><span class="hs-identifier hs-var">descr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-138"></span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564670"><span class="hs-identifier hs-var">sosFmt</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564669"><span class="hs-identifier hs-var">losFmt</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-139"></span><span>     </span><span class="hs-special">(</span><span id="local-6989586621679564668"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564668"><span class="hs-identifier hs-var">d</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564667"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564667"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564670"><span class="hs-identifier hs-var">sosFmt</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564669"><span class="hs-identifier hs-var">losFmt</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564668"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(String, String, String)
-&gt; [(String, String, String)] -&gt; [(String, String, String)]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564666"><span class="hs-identifier hs-var">d'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679564666"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564666"><span class="hs-identifier hs-var">d'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564667"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-140"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679564665"><span class="annot"><span class="annottext">sepBy :: Char -&gt; [String] -&gt; String
</span><a href="#local-6989586621679564665"><span class="hs-identifier hs-var hs-var">sepBy</span></a></span></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-141"></span><span>         </span><span class="annot"><a href="#local-6989586621679564665"><span class="hs-identifier hs-var">sepBy</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">[</span><span id="local-6989586621679564664"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564664"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564664"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-142"></span><span>         </span><span class="annot"><a href="#local-6989586621679564665"><span class="hs-identifier hs-var">sepBy</span></a></span><span> </span><span id="local-6989586621679564663"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564663"><span class="hs-identifier hs-var">ch</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679564662"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564662"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564661"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564661"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564662"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564663"><span class="hs-identifier hs-var">ch</span></a></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">Char -&gt; [String] -&gt; String
</span><a href="#local-6989586621679564665"><span class="hs-identifier hs-var">sepBy</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564663"><span class="hs-identifier hs-var">ch</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564661"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-143"></span><span>         </span><span id="local-6989586621679564670"><span class="annot"><span class="annottext">sosFmt :: String
</span><a href="#local-6989586621679564670"><span class="hs-identifier hs-var hs-var">sosFmt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; [String] -&gt; String
</span><a href="#local-6989586621679564665"><span class="hs-identifier hs-var">sepBy</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">','</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; String) -&gt; String -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgDescr a -&gt; Char -&gt; String
forall a. ArgDescr a -&gt; Char -&gt; String
</span><a href="System.Console.GetOpt.html#fmtShort"><span class="hs-identifier hs-var">fmtShort</span></a></span><span> </span><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564673"><span class="hs-identifier hs-var">ad</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564675"><span class="hs-identifier hs-var">sos</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span>         </span><span id="local-6989586621679564669"><span class="annot"><span class="annottext">losFmt :: String
</span><a href="#local-6989586621679564669"><span class="hs-identifier hs-var hs-var">losFmt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; [String] -&gt; String
</span><a href="#local-6989586621679564665"><span class="hs-identifier hs-var">sepBy</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">','</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgDescr a -&gt; String -&gt; String
forall a. ArgDescr a -&gt; String -&gt; String
</span><a href="System.Console.GetOpt.html#fmtLong"><span class="hs-identifier hs-var">fmtLong</span></a></span><span>  </span><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564673"><span class="hs-identifier hs-var">ad</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564674"><span class="hs-identifier hs-var">los</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span id="local-6989586621679564786"><span class="annot"><a href="System.Console.GetOpt.html#fmtShort"><span class="hs-identifier hs-type">fmtShort</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#ArgDescr"><span class="hs-identifier hs-type">ArgDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564786"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span></span><span>
</span><span id="line-147"></span><span id="fmtShort"><span class="annot"><span class="annottext">fmtShort :: forall a. ArgDescr a -&gt; Char -&gt; String
</span><a href="System.Console.GetOpt.html#fmtShort"><span class="hs-identifier hs-var hs-var">fmtShort</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-type">NoArg</span></a></span><span>  </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564658"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564658"><span class="hs-identifier hs-var">so</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564658"><span class="hs-identifier hs-var">so</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-148"></span><span class="annot"><a href="System.Console.GetOpt.html#fmtShort"><span class="hs-identifier hs-var">fmtShort</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564657"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564657"><span class="hs-identifier hs-var">ad</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564656"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564656"><span class="hs-identifier hs-var">so</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564656"><span class="hs-identifier hs-var">so</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564657"><span class="hs-identifier hs-var">ad</span></a></span><span>
</span><span id="line-149"></span><span class="annot"><a href="System.Console.GetOpt.html#fmtShort"><span class="hs-identifier hs-var">fmtShort</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-type">OptArg</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564655"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564655"><span class="hs-identifier hs-var">ad</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564654"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564654"><span class="hs-identifier hs-var">so</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564654"><span class="hs-identifier hs-var">so</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;[&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564655"><span class="hs-identifier hs-var">ad</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;]&quot;</span></span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span id="local-6989586621679564785"><span class="annot"><a href="System.Console.GetOpt.html#fmtLong"><span class="hs-identifier hs-type">fmtLong</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#ArgDescr"><span class="hs-identifier hs-type">ArgDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564785"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span></span><span>
</span><span id="line-152"></span><span id="fmtLong"><span class="annot"><span class="annottext">fmtLong :: forall a. ArgDescr a -&gt; String -&gt; String
</span><a href="System.Console.GetOpt.html#fmtLong"><span class="hs-identifier hs-var hs-var">fmtLong</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-type">NoArg</span></a></span><span>  </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564653"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564653"><span class="hs-identifier hs-var">lo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564653"><span class="hs-identifier hs-var">lo</span></a></span><span>
</span><span id="line-153"></span><span class="annot"><a href="System.Console.GetOpt.html#fmtLong"><span class="hs-identifier hs-var">fmtLong</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564652"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564652"><span class="hs-identifier hs-var">ad</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564651"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564651"><span class="hs-identifier hs-var">lo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564651"><span class="hs-identifier hs-var">lo</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;=&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564652"><span class="hs-identifier hs-var">ad</span></a></span><span>
</span><span id="line-154"></span><span class="annot"><a href="System.Console.GetOpt.html#fmtLong"><span class="hs-identifier hs-var">fmtLong</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-type">OptArg</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564650"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564650"><span class="hs-identifier hs-var">ad</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564649"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564649"><span class="hs-identifier hs-var">lo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564649"><span class="hs-identifier hs-var">lo</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;[=&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564650"><span class="hs-identifier hs-var">ad</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;]&quot;</span></span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span class="hs-comment">{-|
Process the command-line, and return the list of values that matched
(and those that didn\'t). The arguments are:

* The order requirements (see 'ArgOrder')

* The option descriptions (see 'OptDescr')

* The actual command line arguments (presumably got from 
  'System.Environment.getArgs').

'getOpt' returns a triple consisting of the option arguments, a list
of non-options, and a list of error messages.
-}</span><span>
</span><span id="line-170"></span><span id="local-6989586621679564782"><span class="annot"><a href="System.Console.GetOpt.html#getOpt"><span class="hs-identifier hs-type">getOpt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#ArgOrder"><span class="hs-identifier hs-type">ArgOrder</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564782"><span class="hs-identifier hs-type">a</span></a></span><span>                   </span><span class="hs-comment">-- non-option handling</span><span>
</span><span id="line-171"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564782"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>                 </span><span class="hs-comment">-- option descriptors</span><span>
</span><span id="line-172"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>                     </span><span class="hs-comment">-- the command-line arguments</span><span>
</span><span id="line-173"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679564782"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>      </span><span class="hs-comment">-- (options,non-options,error messages)</span><span>
</span><span id="line-174"></span><span id="getOpt"><span class="annot"><span class="annottext">getOpt :: forall a.
ArgOrder a -&gt; [OptDescr a] -&gt; [String] -&gt; ([a], [String], [String])
</span><a href="System.Console.GetOpt.html#getOpt"><span class="hs-identifier hs-var hs-var">getOpt</span></a></span></span><span> </span><span id="local-6989586621679564648"><span class="annot"><span class="annottext">ArgOrder a
</span><a href="#local-6989586621679564648"><span class="hs-identifier hs-var">ordering</span></a></span></span><span> </span><span id="local-6989586621679564647"><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564647"><span class="hs-identifier hs-var">optDescr</span></a></span></span><span> </span><span id="local-6989586621679564646"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564646"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679564645"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564644"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564643"><span class="hs-identifier hs-var">es</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; [String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; [String] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="System.Console.GetOpt.html#errUnrec"><span class="hs-identifier hs-var">errUnrec</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564641"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679564645"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679564645"><span class="hs-identifier hs-var">os</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564644"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564644"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564641"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564641"><span class="hs-identifier hs-var">us</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564643"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564643"><span class="hs-identifier hs-var">es</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgOrder a
-&gt; [OptDescr a] -&gt; [String] -&gt; ([a], [String], [String], [String])
forall a.
ArgOrder a
-&gt; [OptDescr a] -&gt; [String] -&gt; ([a], [String], [String], [String])
</span><a href="System.Console.GetOpt.html#getOpt%27"><span class="hs-identifier hs-var">getOpt'</span></a></span><span> </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="#local-6989586621679564648"><span class="hs-identifier hs-var">ordering</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564647"><span class="hs-identifier hs-var">optDescr</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564646"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="hs-comment">{-|
This is almost the same as 'getOpt', but returns a quadruple
consisting of the option arguments, a list of non-options, a list of
unrecognized options, and a list of error messages.
-}</span><span>
</span><span id="line-182"></span><span id="local-6989586621679564780"><span class="annot"><a href="System.Console.GetOpt.html#getOpt%27"><span class="hs-identifier hs-type">getOpt'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#ArgOrder"><span class="hs-identifier hs-type">ArgOrder</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564780"><span class="hs-identifier hs-type">a</span></a></span><span>                         </span><span class="hs-comment">-- non-option handling</span><span>
</span><span id="line-183"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564780"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>                       </span><span class="hs-comment">-- option descriptors</span><span>
</span><span id="line-184"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>                           </span><span class="hs-comment">-- the command-line arguments</span><span>
</span><span id="line-185"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679564780"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span> </span><span class="hs-comment">-- (options,non-options,unrecognized,error messages)</span><span>
</span><span id="line-186"></span><span id="getOpt%27"><span class="annot"><span class="annottext">getOpt' :: forall a.
ArgOrder a
-&gt; [OptDescr a] -&gt; [String] -&gt; ([a], [String], [String], [String])
</span><a href="System.Console.GetOpt.html#getOpt%27"><span class="hs-identifier hs-var hs-var">getOpt'</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgOrder a
</span><span class="hs-identifier">_</span></span><span>        </span><span class="annot"><span class="annottext">[OptDescr a]
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-187"></span><span class="annot"><a href="System.Console.GetOpt.html#getOpt%27"><span class="hs-identifier hs-var">getOpt'</span></a></span><span> </span><span id="local-6989586621679564640"><span class="annot"><span class="annottext">ArgOrder a
</span><a href="#local-6989586621679564640"><span class="hs-identifier hs-var">ordering</span></a></span></span><span> </span><span id="local-6989586621679564639"><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564639"><span class="hs-identifier hs-var">optDescr</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679564638"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564638"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564637"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564637"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OptKind a -&gt; ArgOrder a -&gt; ([a], [String], [String], [String])
</span><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="annot"><span class="annottext">OptKind a
</span><a href="#local-6989586621679564635"><span class="hs-identifier hs-var">opt</span></a></span><span> </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="#local-6989586621679564640"><span class="hs-identifier hs-var">ordering</span></a></span><span>
</span><span id="line-188"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679564636"><span class="annot"><span class="annottext">procNextOpt :: OptKind a -&gt; ArgOrder a -&gt; ([a], [String], [String], [String])
</span><a href="#local-6989586621679564636"><span class="hs-identifier hs-var hs-var">procNextOpt</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-type">Opt</span></a></span><span> </span><span id="local-6989586621679564634"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564634"><span class="hs-identifier hs-var">o</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="annot"><span class="annottext">ArgOrder a
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564634"><span class="hs-identifier hs-var">o</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679564633"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564632"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564631"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564630"><span class="hs-identifier hs-var">es</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-189"></span><span>         </span><span class="annot"><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#UnreqOpt"><span class="hs-identifier hs-type">UnreqOpt</span></a></span><span> </span><span id="local-6989586621679564629"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564629"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ArgOrder a
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679564633"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564632"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564629"><span class="hs-identifier hs-var">u</span></a></span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564631"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564630"><span class="hs-identifier hs-var">es</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-190"></span><span>         </span><span class="annot"><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#NonOpt"><span class="hs-identifier hs-type">NonOpt</span></a></span><span> </span><span id="local-6989586621679564628"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564628"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="System.Console.GetOpt.html#RequireOrder"><span class="hs-identifier hs-var">RequireOrder</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564628"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564627"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-191"></span><span>         </span><span class="annot"><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#NonOpt"><span class="hs-identifier hs-type">NonOpt</span></a></span><span> </span><span id="local-6989586621679564626"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564626"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="System.Console.GetOpt.html#Permute"><span class="hs-identifier hs-var">Permute</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679564633"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564626"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564632"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564631"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564630"><span class="hs-identifier hs-var">es</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span>         </span><span class="annot"><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#NonOpt"><span class="hs-identifier hs-type">NonOpt</span></a></span><span> </span><span id="local-6989586621679564625"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564625"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReturnInOrder"><span class="hs-identifier hs-type">ReturnInOrder</span></a></span><span> </span><span id="local-6989586621679564624"><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564624"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564624"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564625"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679564633"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564632"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564631"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564630"><span class="hs-identifier hs-var">es</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>         </span><span class="annot"><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="annot"><span class="annottext">OptKind a
</span><a href="System.Console.GetOpt.html#EndOfOpts"><span class="hs-identifier hs-var">EndOfOpts</span></a></span><span>    </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="System.Console.GetOpt.html#RequireOrder"><span class="hs-identifier hs-var">RequireOrder</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564627"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-194"></span><span>         </span><span class="annot"><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="annot"><span class="annottext">OptKind a
</span><a href="System.Console.GetOpt.html#EndOfOpts"><span class="hs-identifier hs-var">EndOfOpts</span></a></span><span>    </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="System.Console.GetOpt.html#Permute"><span class="hs-identifier hs-var">Permute</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564627"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-195"></span><span>         </span><span class="annot"><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="annot"><span class="annottext">OptKind a
</span><a href="System.Console.GetOpt.html#EndOfOpts"><span class="hs-identifier hs-var">EndOfOpts</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReturnInOrder"><span class="hs-identifier hs-type">ReturnInOrder</span></a></span><span> </span><span id="local-6989586621679564623"><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564623"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; a) -&gt; [String] -&gt; [a]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564623"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564627"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-196"></span><span>         </span><span class="annot"><a href="#local-6989586621679564636"><span class="hs-identifier hs-var">procNextOpt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptErr"><span class="hs-identifier hs-type">OptErr</span></a></span><span> </span><span id="local-6989586621679564622"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564622"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="annot"><span class="annottext">ArgOrder a
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679564633"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564632"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564631"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564622"><span class="hs-identifier hs-var">e</span></a></span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564630"><span class="hs-identifier hs-var">es</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span>         </span><span class="hs-special">(</span><span id="local-6989586621679564635"><span class="annot"><span class="annottext">OptKind a
</span><a href="#local-6989586621679564635"><span class="hs-identifier hs-var">opt</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564627"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564627"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
forall a.
String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
</span><a href="System.Console.GetOpt.html#getNext"><span class="hs-identifier hs-var">getNext</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564638"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564637"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564639"><span class="hs-identifier hs-var">optDescr</span></a></span><span>
</span><span id="line-199"></span><span>         </span><span class="hs-special">(</span><span id="local-6989586621679564633"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679564633"><span class="hs-identifier hs-var">os</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564632"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564632"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564631"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564631"><span class="hs-identifier hs-var">us</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564630"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564630"><span class="hs-identifier hs-var">es</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgOrder a
-&gt; [OptDescr a] -&gt; [String] -&gt; ([a], [String], [String], [String])
forall a.
ArgOrder a
-&gt; [OptDescr a] -&gt; [String] -&gt; ([a], [String], [String], [String])
</span><a href="System.Console.GetOpt.html#getOpt%27"><span class="hs-identifier hs-var">getOpt'</span></a></span><span> </span><span class="annot"><span class="annottext">ArgOrder a
</span><a href="#local-6989586621679564640"><span class="hs-identifier hs-var">ordering</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564639"><span class="hs-identifier hs-var">optDescr</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564627"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-200"></span><span>
</span><span id="line-201"></span><span class="hs-comment">-- take a look at the next cmd line arg and decide what to do with it</span><span>
</span><span id="line-202"></span><span id="local-6989586621679564777"><span class="annot"><a href="System.Console.GetOpt.html#getNext"><span class="hs-identifier hs-type">getNext</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564777"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptKind"><span class="hs-identifier hs-type">OptKind</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564777"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-203"></span><span id="getNext"><span class="annot"><span class="annottext">getNext :: forall a.
String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
</span><a href="System.Console.GetOpt.html#getNext"><span class="hs-identifier hs-var hs-var">getNext</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564620"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564620"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OptKind a
forall a. OptKind a
</span><a href="System.Console.GetOpt.html#EndOfOpts"><span class="hs-identifier hs-var">EndOfOpts</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564620"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span class="annot"><a href="System.Console.GetOpt.html#getNext"><span class="hs-identifier hs-var">getNext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564619"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564619"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564618"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564618"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span id="local-6989586621679564617"><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564617"><span class="hs-identifier hs-var">optDescr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
forall a.
String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
</span><a href="System.Console.GetOpt.html#longOpt"><span class="hs-identifier hs-var">longOpt</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564619"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564618"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564617"><span class="hs-identifier hs-var">optDescr</span></a></span><span>
</span><span id="line-205"></span><span class="annot"><a href="System.Console.GetOpt.html#getNext"><span class="hs-identifier hs-var">getNext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span> </span><span id="local-6989586621679564615"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564615"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564614"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564614"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564613"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564613"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span id="local-6989586621679564612"><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564612"><span class="hs-identifier hs-var">optDescr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
forall a.
Char -&gt; String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
</span><a href="System.Console.GetOpt.html#shortOpt"><span class="hs-identifier hs-var">shortOpt</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564615"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564614"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564613"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564612"><span class="hs-identifier hs-var">optDescr</span></a></span><span>
</span><span id="line-206"></span><span class="annot"><a href="System.Console.GetOpt.html#getNext"><span class="hs-identifier hs-var">getNext</span></a></span><span> </span><span id="local-6989586621679564610"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564610"><span class="hs-identifier hs-var">a</span></a></span></span><span>            </span><span id="local-6989586621679564609"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564609"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; OptKind a
forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#NonOpt"><span class="hs-identifier hs-var">NonOpt</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564610"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564609"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span class="hs-comment">-- handle long option</span><span>
</span><span id="line-209"></span><span id="local-6989586621679564608"><span class="annot"><a href="System.Console.GetOpt.html#longOpt"><span class="hs-identifier hs-type">longOpt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564608"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptKind"><span class="hs-identifier hs-type">OptKind</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564608"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-210"></span><span id="longOpt"><span class="annot"><span class="annottext">longOpt :: forall a.
String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
</span><a href="System.Console.GetOpt.html#longOpt"><span class="hs-identifier hs-var hs-var">longOpt</span></a></span></span><span> </span><span id="local-6989586621679564607"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564607"><span class="hs-identifier hs-var">ls</span></a></span></span><span> </span><span id="local-6989586621679564606"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564606"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span id="local-6989586621679564605"><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564605"><span class="hs-identifier hs-var">optDescr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgDescr a] -&gt; String -&gt; [String] -&gt; (OptKind a, [String])
</span><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgDescr a]
</span><a href="#local-6989586621679564603"><span class="hs-identifier hs-var">ads</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564602"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564606"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-211"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679564599"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564599"><span class="hs-identifier hs-var">opt</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679564602"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564602"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; String -&gt; (String, String)
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'='</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564607"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-212"></span><span>         </span><span id="local-6989586621679564591"><span class="annot"><span class="annottext">getWith :: (String -&gt; String -&gt; Bool) -&gt; [OptDescr a]
</span><a href="#local-6989586621679564591"><span class="hs-identifier hs-var hs-var">getWith</span></a></span></span><span> </span><span id="local-6989586621679564590"><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
</span><a href="#local-6989586621679564590"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">OptDescr a
</span><a href="#local-6989586621679564589"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679564589"><span class="annot"><span class="annottext">o :: OptDescr a
</span><a href="#local-6989586621679564589"><span class="hs-identifier hs-var">o</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564588"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564588"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgDescr a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564605"><span class="hs-identifier hs-var">optDescr</span></a></span><span>
</span><span id="line-213"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Bool) -&gt; [String] -&gt; Maybe String
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Maybe a
</span><a href="Data.Foldable.html#find"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
</span><a href="#local-6989586621679564590"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564599"><span class="hs-identifier hs-var">opt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564588"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; Maybe String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-214"></span><span>         </span><span id="local-6989586621679564584"><span class="annot"><span class="annottext">exact :: [OptDescr a]
</span><a href="#local-6989586621679564584"><span class="hs-identifier hs-var hs-var">exact</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; String -&gt; Bool) -&gt; [OptDescr a]
</span><a href="#local-6989586621679564591"><span class="hs-identifier hs-var">getWith</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">(==)</span></a></span><span>
</span><span id="line-215"></span><span>         </span><span id="local-6989586621679564581"><span class="annot"><span class="annottext">options :: [OptDescr a]
</span><a href="#local-6989586621679564581"><span class="hs-identifier hs-var hs-var">options</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[OptDescr a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564584"><span class="hs-identifier hs-var">exact</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">(String -&gt; String -&gt; Bool) -&gt; [OptDescr a]
</span><a href="#local-6989586621679564591"><span class="hs-identifier hs-var">getWith</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; [a] -&gt; [a] -&gt; Bool
</span><a href="Data.OldList.html#isPrefixOf"><span class="hs-identifier hs-var">isPrefixOf</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564584"><span class="hs-identifier hs-var">exact</span></a></span><span>
</span><span id="line-216"></span><span>         </span><span id="local-6989586621679564603"><span class="annot"><span class="annottext">ads :: [ArgDescr a]
</span><a href="#local-6989586621679564603"><span class="hs-identifier hs-var hs-var">ads</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564579"><span class="hs-identifier hs-var">ad</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564579"><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564579"><span class="hs-identifier hs-var">ad</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564581"><span class="hs-identifier hs-var">options</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-217"></span><span>         </span><span id="local-6989586621679564578"><span class="annot"><span class="annottext">optStr :: String
</span><a href="#local-6989586621679564578"><span class="hs-identifier hs-var hs-var">optStr</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--&quot;</span></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564599"><span class="hs-identifier hs-var">opt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span>         </span><span id="local-6989586621679564604"><span class="annot"><span class="annottext">long :: [ArgDescr a] -&gt; String -&gt; [String] -&gt; (OptKind a, [String])
</span><a href="#local-6989586621679564604"><span class="hs-identifier hs-var hs-var">long</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgDescr a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">ArgDescr a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>      </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span>        </span><span id="local-6989586621679564577"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564577"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[OptDescr a] -&gt; String -&gt; OptKind a
forall a. [OptDescr a] -&gt; String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#errAmbig"><span class="hs-identifier hs-var">errAmbig</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564581"><span class="hs-identifier hs-var">options</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564578"><span class="hs-identifier hs-var">optStr</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564577"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>         </span><span class="annot"><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-type">NoArg</span></a></span><span>  </span><span id="local-6989586621679564575"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564575"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span id="local-6989586621679564574"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564574"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564575"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564574"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span>         </span><span class="annot"><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-type">NoArg</span></a></span><span>  </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'='</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span id="local-6989586621679564573"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564573"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; OptKind a
forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#errNoArg"><span class="hs-identifier hs-var">errNoArg</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564578"><span class="hs-identifier hs-var">optStr</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564573"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span>         </span><span class="annot"><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564571"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564571"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; OptKind a
forall a. String -&gt; String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#errReq"><span class="hs-identifier hs-var">errReq</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564571"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564578"><span class="hs-identifier hs-var">optStr</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-223"></span><span>         </span><span class="annot"><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span id="local-6989586621679564569"><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564569"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span class="hs-special">(</span><span id="local-6989586621679564568"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564568"><span class="hs-identifier hs-var">r</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564567"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564567"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564569"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564568"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564567"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span>         </span><span class="annot"><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span id="local-6989586621679564566"><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564566"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'='</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564565"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564565"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564564"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564564"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564566"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564565"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564564"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-225"></span><span>         </span><span class="annot"><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-type">OptArg</span></a></span><span> </span><span id="local-6989586621679564563"><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564563"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span id="local-6989586621679564562"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564562"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564563"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564562"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>         </span><span class="annot"><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-type">OptArg</span></a></span><span> </span><span id="local-6989586621679564561"><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564561"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'='</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564560"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564560"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564559"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564559"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564561"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe String
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564560"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564559"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>         </span><span class="annot"><a href="#local-6989586621679564604"><span class="hs-identifier hs-var">long</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span>            </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span>        </span><span id="local-6989586621679564558"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564558"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; OptKind a
forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#UnreqOpt"><span class="hs-identifier hs-var">UnreqOpt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;--&quot;</span></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564607"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564558"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span>
</span><span id="line-229"></span><span class="hs-comment">-- handle short option</span><span>
</span><span id="line-230"></span><span id="local-6989586621679564774"><span class="annot"><a href="System.Console.GetOpt.html#shortOpt"><span class="hs-identifier hs-type">shortOpt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564774"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptKind"><span class="hs-identifier hs-type">OptKind</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564774"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-231"></span><span id="shortOpt"><span class="annot"><span class="annottext">shortOpt :: forall a.
Char -&gt; String -&gt; [String] -&gt; [OptDescr a] -&gt; (OptKind a, [String])
</span><a href="System.Console.GetOpt.html#shortOpt"><span class="hs-identifier hs-var hs-var">shortOpt</span></a></span></span><span> </span><span id="local-6989586621679564557"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564557"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679564556"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564556"><span class="hs-identifier hs-var">ys</span></a></span></span><span> </span><span id="local-6989586621679564555"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564555"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span id="local-6989586621679564554"><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564554"><span class="hs-identifier hs-var">optDescr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgDescr a] -&gt; String -&gt; [String] -&gt; (OptKind a, [String])
</span><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgDescr a]
</span><a href="#local-6989586621679564552"><span class="hs-identifier hs-var">ads</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564556"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564555"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-232"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679564550"><span class="annot"><span class="annottext">options :: [OptDescr a]
</span><a href="#local-6989586621679564550"><span class="hs-identifier hs-var hs-var">options</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">OptDescr a
</span><a href="#local-6989586621679564549"><span class="hs-identifier hs-var">o</span></a></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679564549"><span class="annot"><span class="annottext">o :: OptDescr a
</span><a href="#local-6989586621679564549"><span class="hs-identifier hs-var">o</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span id="local-6989586621679564548"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564548"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ArgDescr a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564554"><span class="hs-identifier hs-var">optDescr</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679564547"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564547"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564548"><span class="hs-identifier hs-var">ss</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564557"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564547"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-233"></span><span>        </span><span id="local-6989586621679564552"><span class="annot"><span class="annottext">ads :: [ArgDescr a]
</span><a href="#local-6989586621679564552"><span class="hs-identifier hs-var hs-var">ads</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564546"><span class="hs-identifier hs-var">ad</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#Option"><span class="hs-identifier hs-type">Option</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[String]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564546"><span class="annot"><span class="annottext">ArgDescr a
</span><a href="#local-6989586621679564546"><span class="hs-identifier hs-var">ad</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564550"><span class="hs-identifier hs-var">options</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-234"></span><span>        </span><span id="local-6989586621679564545"><span class="annot"><span class="annottext">optStr :: String
</span><a href="#local-6989586621679564545"><span class="hs-identifier hs-var hs-var">optStr</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679564557"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>        </span><span id="local-6989586621679564553"><span class="annot"><span class="annottext">short :: [ArgDescr a] -&gt; String -&gt; [String] -&gt; (OptKind a, [String])
</span><a href="#local-6989586621679564553"><span class="hs-identifier hs-var hs-var">short</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgDescr a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">ArgDescr a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>        </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span>  </span><span id="local-6989586621679564544"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564544"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[OptDescr a] -&gt; String -&gt; OptKind a
forall a. [OptDescr a] -&gt; String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#errAmbig"><span class="hs-identifier hs-var">errAmbig</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564550"><span class="hs-identifier hs-var">options</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564545"><span class="hs-identifier hs-var">optStr</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564544"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-237"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-type">NoArg</span></a></span><span>  </span><span id="local-6989586621679564543"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564543"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621679564542"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564542"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564543"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564542"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-238"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#NoArg"><span class="hs-identifier hs-type">NoArg</span></a></span><span>  </span><span id="local-6989586621679564541"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564541"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564540"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564540"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679564539"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564539"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679564541"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564540"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564539"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-239"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679564538"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564538"><span class="hs-identifier hs-var">d</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String -&gt; OptKind a
forall a. String -&gt; String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#errReq"><span class="hs-identifier hs-var">errReq</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564538"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564545"><span class="hs-identifier hs-var">optStr</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-240"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span id="local-6989586621679564537"><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564537"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679564536"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564536"><span class="hs-identifier hs-var">r</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679564535"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564535"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564537"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564536"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564535"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-241"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#ReqArg"><span class="hs-identifier hs-type">ReqArg</span></a></span><span> </span><span id="local-6989586621679564534"><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564534"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564533"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564533"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679564532"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564532"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; a
</span><a href="#local-6989586621679564534"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564533"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564532"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-242"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-type">OptArg</span></a></span><span> </span><span id="local-6989586621679564531"><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564531"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621679564530"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564530"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564531"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564530"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-243"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="System.Console.GetOpt.html#OptArg"><span class="hs-identifier hs-type">OptArg</span></a></span><span> </span><span id="local-6989586621679564529"><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564529"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[ArgDescr a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679564528"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564528"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679564527"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564527"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; OptKind a
forall a. a -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#Opt"><span class="hs-identifier hs-var">Opt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe String -&gt; a
</span><a href="#local-6989586621679564529"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe String
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564528"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564527"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-244"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621679564526"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564526"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; OptKind a
forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#UnreqOpt"><span class="hs-identifier hs-var">UnreqOpt</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564545"><span class="hs-identifier hs-var">optStr</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564526"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-245"></span><span>        </span><span class="annot"><a href="#local-6989586621679564553"><span class="hs-identifier hs-var">short</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span id="local-6989586621679564525"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564525"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679564524"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564524"><span class="hs-identifier hs-var">rest</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; OptKind a
forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#UnreqOpt"><span class="hs-identifier hs-var">UnreqOpt</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564545"><span class="hs-identifier hs-var">optStr</span></a></span><span class="hs-special">,</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564525"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679564524"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span>
</span><span id="line-247"></span><span class="hs-comment">-- miscellaneous error formatting</span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span id="local-6989586621679564765"><span class="annot"><a href="System.Console.GetOpt.html#errAmbig"><span class="hs-identifier hs-type">errAmbig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="System.Console.GetOpt.html#OptDescr"><span class="hs-identifier hs-type">OptDescr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564765"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#OptKind"><span class="hs-identifier hs-type">OptKind</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564765"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-250"></span><span id="errAmbig"><span class="annot"><span class="annottext">errAmbig :: forall a. [OptDescr a] -&gt; String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#errAmbig"><span class="hs-identifier hs-var hs-var">errAmbig</span></a></span></span><span> </span><span id="local-6989586621679564523"><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564523"><span class="hs-identifier hs-var">ods</span></a></span></span><span> </span><span id="local-6989586621679564522"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564522"><span class="hs-identifier hs-var">optStr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; OptKind a
forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#OptErr"><span class="hs-identifier hs-var">OptErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [OptDescr a] -&gt; String
forall a. String -&gt; [OptDescr a] -&gt; String
</span><a href="System.Console.GetOpt.html#usageInfo"><span class="hs-identifier hs-var">usageInfo</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564521"><span class="hs-identifier hs-var">header</span></a></span><span> </span><span class="annot"><span class="annottext">[OptDescr a]
</span><a href="#local-6989586621679564523"><span class="hs-identifier hs-var">ods</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-251"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679564521"><span class="annot"><span class="annottext">header :: String
</span><a href="#local-6989586621679564521"><span class="hs-identifier hs-var hs-var">header</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;option `&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564522"><span class="hs-identifier hs-var">optStr</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;' is ambiguous; could be one of:&quot;</span></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span id="local-6989586621679564764"><span class="annot"><a href="System.Console.GetOpt.html#errReq"><span class="hs-identifier hs-type">errReq</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#OptKind"><span class="hs-identifier hs-type">OptKind</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564764"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-254"></span><span id="errReq"><span class="annot"><span class="annottext">errReq :: forall a. String -&gt; String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#errReq"><span class="hs-identifier hs-var hs-var">errReq</span></a></span></span><span> </span><span id="local-6989586621679564520"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564520"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span id="local-6989586621679564519"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564519"><span class="hs-identifier hs-var">optStr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; OptKind a
forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#OptErr"><span class="hs-identifier hs-var">OptErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;option `&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564519"><span class="hs-identifier hs-var">optStr</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;' requires an argument &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564520"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;\n&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span class="annot"><a href="System.Console.GetOpt.html#errUnrec"><span class="hs-identifier hs-type">errUnrec</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-257"></span><span id="errUnrec"><span class="annot"><span class="annottext">errUnrec :: String -&gt; String
</span><a href="System.Console.GetOpt.html#errUnrec"><span class="hs-identifier hs-var hs-var">errUnrec</span></a></span></span><span> </span><span id="local-6989586621679564518"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564518"><span class="hs-identifier hs-var">optStr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unrecognized option `&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564518"><span class="hs-identifier hs-var">optStr</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;'\n&quot;</span></span><span>
</span><span id="line-258"></span><span>
</span><span id="line-259"></span><span id="local-6989586621679564517"><span class="annot"><a href="System.Console.GetOpt.html#errNoArg"><span class="hs-identifier hs-type">errNoArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="System.Console.GetOpt.html#OptKind"><span class="hs-identifier hs-type">OptKind</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679564517"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-260"></span><span id="errNoArg"><span class="annot"><span class="annottext">errNoArg :: forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#errNoArg"><span class="hs-identifier hs-var hs-var">errNoArg</span></a></span></span><span> </span><span id="local-6989586621679564516"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564516"><span class="hs-identifier hs-var">optStr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; OptKind a
forall a. String -&gt; OptKind a
</span><a href="System.Console.GetOpt.html#OptErr"><span class="hs-identifier hs-var">OptErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;option `&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679564516"><span class="hs-identifier hs-var">optStr</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;' doesn't allow an argument\n&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span class="hs-comment">{-
-----------------------------------------------------------------------------------------
-- and here a small and hopefully enlightening example:

data Flag = Verbose | Version | Name String | Output String | Arg String   deriving Show

options :: [OptDescr Flag]
options =
   [Option ['v']     [&quot;verbose&quot;]           (NoArg Verbose)      &quot;verbosely list files&quot;,
    Option ['V','?'] [&quot;version&quot;,&quot;release&quot;] (NoArg Version)      &quot;show version info&quot;,
    Option ['o']     [&quot;output&quot;]            (OptArg out &quot;FILE&quot;)  &quot;use FILE for dump&quot;,
    Option ['n']     [&quot;name&quot;]              (ReqArg Name &quot;USER&quot;) &quot;only dump USER's files&quot;]

out :: Maybe String -&gt; Flag
out Nothing  = Output &quot;stdout&quot;
out (Just o) = Output o

test :: ArgOrder Flag -&gt; [String] -&gt; String
test order cmdline = case getOpt order options cmdline of
                        (o,n,[]  ) -&gt; &quot;options=&quot; ++ show o ++ &quot;  args=&quot; ++ show n ++ &quot;\n&quot;
                        (_,_,errs) -&gt; concat errs ++ usageInfo header options
   where header = &quot;Usage: foobar [OPTION...] files...&quot;

-- example runs:
-- putStr (test RequireOrder [&quot;foo&quot;,&quot;-v&quot;])
--    ==&gt; options=[]  args=[&quot;foo&quot;, &quot;-v&quot;]
-- putStr (test Permute [&quot;foo&quot;,&quot;-v&quot;])
--    ==&gt; options=[Verbose]  args=[&quot;foo&quot;]
-- putStr (test (ReturnInOrder Arg) [&quot;foo&quot;,&quot;-v&quot;])
--    ==&gt; options=[Arg &quot;foo&quot;, Verbose]  args=[]
-- putStr (test Permute [&quot;foo&quot;,&quot;--&quot;,&quot;-v&quot;])
--    ==&gt; options=[]  args=[&quot;foo&quot;, &quot;-v&quot;]
-- putStr (test Permute [&quot;-?o&quot;,&quot;--name&quot;,&quot;bar&quot;,&quot;--na=baz&quot;])
--    ==&gt; options=[Version, Output &quot;stdout&quot;, Name &quot;bar&quot;, Name &quot;baz&quot;]  args=[]
-- putStr (test Permute [&quot;--ver&quot;,&quot;foo&quot;])
--    ==&gt; option `--ver' is ambiguous; could be one of:
--          -v      --verbose             verbosely list files
--          -V, -?  --version, --release  show version info   
--        Usage: foobar [OPTION...] files...
--          -v        --verbose             verbosely list files  
--          -V, -?    --version, --release  show version info     
--          -o[FILE]  --output[=FILE]       use FILE for dump     
--          -n USER   --name=USER           only dump USER's files
-----------------------------------------------------------------------------------------
-}</span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span class="hs-comment">{- $example1

A simple choice for the type associated with flags is to define a type
@Flag@ as an algebraic type representing the possible flags and their
arguments:

&gt;    module Opts1 where
&gt;    
&gt;    import System.Console.GetOpt
&gt;    import Data.Maybe ( fromMaybe )
&gt;    
&gt;    data Flag 
&gt;     = Verbose  | Version 
&gt;     | Input String | Output String | LibDir String
&gt;       deriving Show
&gt;    
&gt;    options :: [OptDescr Flag]
&gt;    options =
&gt;     [ Option ['v']     [&quot;verbose&quot;] (NoArg Verbose)       &quot;chatty output on stderr&quot;
&gt;     , Option ['V','?'] [&quot;version&quot;] (NoArg Version)       &quot;show version number&quot;
&gt;     , Option ['o']     [&quot;output&quot;]  (OptArg outp &quot;FILE&quot;)  &quot;output FILE&quot;
&gt;     , Option ['c']     []          (OptArg inp  &quot;FILE&quot;)  &quot;input FILE&quot;
&gt;     , Option ['L']     [&quot;libdir&quot;]  (ReqArg LibDir &quot;DIR&quot;) &quot;library directory&quot;
&gt;     ]
&gt;    
&gt;    inp,outp :: Maybe String -&gt; Flag
&gt;    outp = Output . fromMaybe &quot;stdout&quot;
&gt;    inp  = Input  . fromMaybe &quot;stdin&quot;
&gt;    
&gt;    compilerOpts :: [String] -&gt; IO ([Flag], [String])
&gt;    compilerOpts argv = 
&gt;       case getOpt Permute options argv of
&gt;          (o,n,[]  ) -&gt; return (o,n)
&gt;          (_,_,errs) -&gt; ioError (userError (concat errs ++ usageInfo header options))
&gt;      where header = &quot;Usage: ic [OPTION...] files...&quot;

Then the rest of the program will use the constructed list of flags
to determine it\'s behaviour.

-}</span><span>
</span><span id="line-348"></span><span>
</span><span id="line-349"></span><span class="hs-comment">{- $example2

A different approach is to group the option values in a record of type
@Options@, and have each flag yield a function of type
@Options -&gt; Options@ transforming this record.

&gt;    module Opts2 where
&gt;
&gt;    import System.Console.GetOpt
&gt;    import Data.Maybe ( fromMaybe )
&gt;
&gt;    data Options = Options
&gt;     { optVerbose     :: Bool
&gt;     , optShowVersion :: Bool
&gt;     , optOutput      :: Maybe FilePath
&gt;     , optInput       :: Maybe FilePath
&gt;     , optLibDirs     :: [FilePath]
&gt;     } deriving Show
&gt;
&gt;    defaultOptions    = Options
&gt;     { optVerbose     = False
&gt;     , optShowVersion = False
&gt;     , optOutput      = Nothing
&gt;     , optInput       = Nothing
&gt;     , optLibDirs     = []
&gt;     }
&gt;
&gt;    options :: [OptDescr (Options -&gt; Options)]
&gt;    options =
&gt;     [ Option ['v']     [&quot;verbose&quot;]
&gt;         (NoArg (\ opts -&gt; opts { optVerbose = True }))
&gt;         &quot;chatty output on stderr&quot;
&gt;     , Option ['V','?'] [&quot;version&quot;]
&gt;         (NoArg (\ opts -&gt; opts { optShowVersion = True }))
&gt;         &quot;show version number&quot;
&gt;     , Option ['o']     [&quot;output&quot;]
&gt;         (OptArg ((\ f opts -&gt; opts { optOutput = Just f }) . fromMaybe &quot;output&quot;)
&gt;                 &quot;FILE&quot;)
&gt;         &quot;output FILE&quot;
&gt;     , Option ['c']     []
&gt;         (OptArg ((\ f opts -&gt; opts { optInput = Just f }) . fromMaybe &quot;input&quot;)
&gt;                 &quot;FILE&quot;)
&gt;         &quot;input FILE&quot;
&gt;     , Option ['L']     [&quot;libdir&quot;]
&gt;         (ReqArg (\ d opts -&gt; opts { optLibDirs = optLibDirs opts ++ [d] }) &quot;DIR&quot;)
&gt;         &quot;library directory&quot;
&gt;     ]
&gt;
&gt;    compilerOpts :: [String] -&gt; IO (Options, [String])
&gt;    compilerOpts argv =
&gt;       case getOpt Permute options argv of
&gt;          (o,n,[]  ) -&gt; return (foldl (flip id) defaultOptions o, n)
&gt;          (_,_,errs) -&gt; ioError (userError (concat errs ++ usageInfo header options))
&gt;      where header = &quot;Usage: ic [OPTION...] files...&quot;

Similarly, each flag could yield a monadic function transforming a record,
of type @Options -&gt; IO Options@ (or any other monad), allowing option
processing to perform actions of the chosen monad, e.g. printing help or
version messages, checking that file arguments exist, etc.

-}</span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span></pre></body></html>